package com.hualan.mapper;

import com.hualan.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    @Select(value = "SELECT id FROM users WHERE nickname = #{nickname} and password = #{password} and del = 0")
    Integer login(@Param("nickname") String nickname, @Param("password") String password);
    @Insert(value = "insert  into users (username, password, nickname, phone, salt) value(#{username},#{password},#{nickname},#{phone},#{salt}) ")
    void register(User user);
    @Select(value = "SELECT nickname FROM users WHERE id = #{id}")
    String findNickname(@Param("id") Integer uid);
    @Select(value = "SELECT phone FROM users WHERE id = #{id}")
    String findPhone(@Param("id") Integer uid);
    @Select(value = "select password from users where id = #{id}")
    String findPwd(Integer id);

    Integer updatePhoneOrPwd(@Param("id") Integer id, @Param("phone") String phone, @Param("pwd") String pwd);

}
